<?php

// 数据库连接
// 数据库连接保存在$GLOBALS['DB']中

define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', 'toor');
define('DB_SCHEMA', 'LAB');

if(!$GLOBALS['DB']=  mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)){
    die('Error: Unable to connect to database server.');
}
if(!mysql_select_db(DB_SCHEMA, $GLOBALS['DB'])){
    mysql_close($GLOBALS['DB']);
    die('Error: Unable to select database schema.');
}
